<!DOCTYPE HTML>
<html>
<head>
        <% include base.ejs %>
</head>
<body>
<% include head.ejs %>
<div class="col-sm-10 col-sm-offset-3 col-md-10 col-md-offset-2">
    <div class="news">
        <div class="news-sec">
            <div class="news-top">
                <div class="col-md-12 news-1">
                    <a href="/article?ID=<%= allResult.ID %>"><h5><%= allResult.topic %></h5></a>
                    <h6><%= allResult.date %></h6>
                    <div class="blog-body">
                        <div class="blog-content">
                            <%- allResult.content %>
                        </div>
                    </div>
                    <p align="center">如果该文章对你有帮助，请点赞。</p>
                    <p align="center">
                        <button type="button" id="thumbsUp" class="btn btn-info btn-lg thumbsUp">点赞</button>
                    </p>
                    <div class="news-footer">
                        <h6 class="post-footer">
                            分类：<%= allResult.classify %> | 评论：未开放 | 浏览：<%= allResult.visitNum %> | 点赞：<%= allResult.thumbsUp %> |
                        </h6>
                    </div>

                </div>
            </div>
        </div>
        <div class="clearfix"> </div>
    </div>
</div>
<div class="clearfix"></div>
<script type="text/javascript">
    //获取url中的参数
    function getUrlParam(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
        var r = window.location.search.substr(1).match(reg);  //匹配目标参数
        if (r != null) return unescape(r[2]); return null; //返回参数值
    }

    var ID = getUrlParam("ID");

    $.post("/addVisitorNum",{"ID":ID},function (result) {
    });

    $("#thumbsUp").click(function () {
        $.post("/addThumbsUp",{"ID":ID},function (result) {
            $("#thumbsUp").attr("disabled","disabled");
            $("#thumbsUp").html("你已点赞");
        });
    });

</script>
</body>
</html>